package by.pavlyukevich.paymentsystem.datamodel.card;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import by.pavlyukevich.paymentsystem.datamodel.AbstractEntity;

@Entity
public class CardLimit extends AbstractEntity<Integer> {

	@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
	@NotNull
	private Card card;

	@Column(name = "type_id")
	@Enumerated(EnumType.ORDINAL)
	@NotNull
	private LimitType limitType;

	@Column
	@NotNull
	private Date periodBegin;

	@Column
	@NotNull
	private Date periodEnd;

	@Column
	@Min(0)
	private Long amount;

	@Column
	@Min(0)
	private Integer quantity;

	@Column
	private Boolean block;

	public Card getCard() {
		return card;
	}

	public void setCard(Card card) {
		this.card = card;
	}

	public LimitType getLimitType() {
		return limitType;
	}

	public void setLimitType(LimitType limitType) {
		this.limitType = limitType;
	}

	public Date getPeriodBegin() {
		return periodBegin;
	}

	public void setPeriodBegin(Date periodBegin) {
		this.periodBegin = periodBegin;
	}

	public Date getPeriodEnd() {
		return periodEnd;
	}

	public void setPeriodEnd(Date periodEnd) {
		this.periodEnd = periodEnd;
	}

	public Long getAmount() {
		return amount;
	}

	public void setAmount(Long amount) {
		this.amount = amount;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public Boolean getBlock() {
		return block;
	}

	public void setBlock(Boolean block) {
		this.block = block;
	}

}
